package xxy.com.customview;

import android.app.ActivityOptions;
import android.content.Intent;
import android.os.Bundle;
import androidx.core.widget.NestedScrollView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;

import butterknife.BindView;
import butterknife.ButterKnife;

public class Main7Activity extends AppCompatActivity {

    @BindView(R.id.main7_button1)
    Button main7Button1;
    @BindView(R.id.main7_toolbar)
    Toolbar main7Toolbar;
    @BindView(R.id.main7_nestedScrollView_1)
    NestedScrollView main7NestedScrollView1;
    @BindView(R.id.main7_nestedScrollView_2)
    NestedScrollView main7NestedScrollView2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main7);
        ButterKnife.bind(this);
//        CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) main7Button1.getLayoutParams();
//        layoutParams.setBehavior(new NestedButtonBehavior());
        init();
        initView();
    }

    private void init() {
        setSupportActionBar(main7Toolbar);
    }

    private void initView() {

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.main7_menu, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int itemId = item.getItemId();
        switch (itemId){
            case R.id.menu_1:
                //回到上一页
                finish();
                return true;
            case R.id.menu_2:
                //跳到下一页
                startActivity(new Intent(Main7Activity.this, Main8Activity.class), ActivityOptions.makeSceneTransitionAnimation(Main7Activity.this).toBundle());
                return true;
        }
        return super.onOptionsItemSelected(item);
    }
}
